Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 1 - Appearance Manager Reference / Appearance Manager Functions
Defining Your Own Menu Drawing Callback Functions /


MyMenuTitleDrawingProc

NEW WITH THE APPEARANCE MANAGER

Draws a custom menu title that coordinates with the current theme.

The Appearance Manager declares the type for an application-defined menu title drawing function as follows:

typedef pascal void (*MenuTitleDrawingProcPtr)(const Rect *inBounds, 
SInt16 inDepth, Boolean inIsColorDevice, SInt32 inUserData);
The Appearance Manager defines the data type MenuTitleDrawingUPP to identify the universal procedure pointer for an application-defined menu title drawing function:

typedef UniversalProcPtr MenuTitleDrawingUPP;
You typically use the NewMenuTitleDrawingProc macro like this:

MenuTitleDrawingUPP myMenuTitleDrawingUPP;
myMenuTitleDrawingUPP = NewMenuTitleDrawingProc(MyMenuTitleDrawingProc);

You typically use the CallMenuTitleDrawingProc macro like this:

CallMenuTitleDrawingProc(myMenuTitleDrawingUPP, inBounds, inDepth, inIsColorDevice, inUserData);

Here's how to declare a custom menu title drawing function, if you were to name the function MyMenuTitleDrawingProc:

pascal void (MyMenuTitleDrawingProc)
                     (const Rect *inBounds,
                     SInt16 inDepth,
                     Boolean inIsColorDevice,
                     SInt32 inUserData);
inBounds
On input, a pointer to a rectangle in which you should draw your menu title content.
inDepth
The bit depth (in pixels) of the current graphics port.
inIsColorDevice
A Boolean value. Set to true to indicate that you are drawing on a color device. Set to false for a monochrome device.
inUserData
User data specifying how to draw the menu title content, passed in from the inTitleData parameter of DrawThemeMenuTitle.
DISCUSSION
Your menu title drawing function will be called clipped to the rectangle in which you are allowed to draw your content; do not draw outside this region. You should center your content vertically inside the content rectangle.

At the time your menu title drawing function is called, the foreground text color and mode is already set to draw in the specified state (enabled, selected, disabled) and correct color for the theme. You do not need to set the color unless you have special drawing needs.

IMPORTANT
You should not depend on the background color for your menu title, so you should not call the EraseRect function from your menu title drawing function.
SPECIAL CONSIDERATIONS
Make sure Appearance Manager 1.0.1 is present before calling your MyMenuTitleDrawingProc function. See "Appearance Manager Gestalt Selector Constants" for details on how to determine if the Appearance Manager is present and what its version is, if so.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998